package psi

import (
	"fmt"
	"strings"
)

/*
计步功能开关
平台发送:
[DW*YYYYYYYYYYYYYYY*LEN*PEDO,0 或者 1]
实例:[DW*334588000000156*0004*PEDO,0]
终端回复:
[DW*YYYYYYYYYYYYYYY*LEN*PEDO]
实例:[DW*334588000000156*0004*PEDO]
说明: 终端计步功能的开关.1 打开，0 关
*/

// 计步功能开关
type PEDO struct {
	Switch int // 0 或者 1
}

func DealPEDO(method string, params map[string]interface{}) (string, error) {
	var pedo PEDO
	err := MapToStruct(params, &pedo)
	if err != nil {
		return "", err
	}
	var messageList []string
	messageList = append(messageList, "PEDO")
	messageList = append(messageList, fmt.Sprint(pedo.Switch))
	message := strings.Join(messageList, ",")
	return message, nil
}
